package com.md.common.utils.web.auth.token;

/**
 * 功能描述：token类型
 *
 * @author lujianping@oak168.com
 * @version 1.0
 * @date 2018-07-16 14:36
 * @since JDK 1.8
 */
public enum TokenTypeEnum {
    USER(1,"用户"),
    VISITOR(2,"访客"),
    ;

    private int value;
    private String name;

    TokenTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public static TokenTypeEnum getEnum(Integer value){
        if(value == null){
            return null;
        }
        for(TokenTypeEnum e : TokenTypeEnum.values()){
            if (e.getValue() == value) {
                return e;
            }
        }
        return null;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
